package com.dwaynema.service.impl;

import com.dwaynema.dao.SysUserMapper;
import com.dwaynema.dto.UserDto;
import com.dwaynema.entity.SysUser;
import com.dwaynema.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.UUID;

@Service
public class UserServiceImpl implements UserService {

    @Autowired
    SysUserMapper sysUserMapper;

    @Override
    public UserDto userLogin(SysUser sysUser) {
        return sysUserMapper.userLogin(sysUser);
    }

    @Override
    public Integer userRegister(SysUser sysUser) {
        sysUser.setUserid( UUID.randomUUID().toString().replaceAll("-",""));
        return sysUserMapper.userRegister(sysUser);
    }

    @Override
    public SysUser userLoginByUsername(String username) {
        return sysUserMapper.userLoginByUsername(username);
    }
}
